package com.czgj.JGB28181.web.controller;

import com.czgj.JGB28181.common.result.GBResult;
import com.czgj.JGB28181.web.service.ActionService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/camera/")
public class ActionController {

    @Resource
    ActionService actionService;


    /**
     * 推流 (播放)
     *
     * @param deviceId      设备的ID
     * @param channelId     通道的ID
     * @param mediaProtocol 流类型 (默认是TCP)
     * @return 返回流信息
     */
    @RequestMapping("play")
    public GBResult play(
            @RequestParam("deviceId") String deviceId,
            @RequestParam("channelId") String channelId,
            @RequestParam(required = false, name = "protocol", defaultValue = "TCP") String
                    mediaProtocol) {
        return actionService.play(deviceId, channelId, mediaProtocol);
    }

    /**
     * bye bye
     */
    @RequestMapping("bye")
    public GBResult bye(@RequestParam("callId") String callId) {
        return actionService.bye(callId);
    }

}
